package com.virgil.core.config;


import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.nepxion.banner.BannerConstant;
import com.nepxion.banner.Description;
import com.nepxion.banner.LogoBanner;
import com.taobao.text.Color;
import com.virgil.core.constant.CommonConstant;
import com.virgil.core.utils.CustomBanner;

/**
 * Banner初始化
 * 生成BANNER的工具: http://www.network-science.de/ascii/
 * @author alfred
 * @date 2019/8/28
 */
public class BannerInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {
        if (!(applicationContext instanceof AnnotationConfigApplicationContext)) {
            LogoBanner logoBanner = new LogoBanner(BannerInitializer.class, "/virgil/logo.txt", "virgil", 1, 7, new Color[1], true);
            CustomBanner.show(logoBanner
            		, new Description(BannerConstant.VERSION + ":", CommonConstant.PROJECT_VERSION, 10, 5)
                    , new Description("Email:", "livelovedie@163.com", 0, 1)
                    , new Description("Gitee:", "https://gitee.com/Nongfu-Cola/Exchange", 0, 1)
            );
        }
    }
}
